import SelectCity from "@/biz-components/select-city";
import {
    Modal,
  } from "antd";

const cityModal = (props: any) => {
  const { title = "请选择城市", ...others } = props;
  // const [value, setValue] = useState(null);
  let modal: any = null;
  const onChange = (value: any, name: string) => {
    props?.onOk(value ? value[value.length - 1] : "", name);
    modal?.destroy();
  };

  modal = Modal.confirm({
    title,
    content: (
      <SelectCity
        {...others}
        countryCode={props?.api?.params?.parentId || 'CN'}
        api={{
          url: "/sym/regionext/findRegionByCountry",
          findByCode: "/sym/region/findByCode",
        }}
        onChange={onChange}
      ></SelectCity>
    ),
    className: "model-excel-modal",
    okButtonProps: props?.multiple ? {} : { style: { display: "none" } },
    width: 600,
    onOk: () => {
      //   props?.onOk(selectedKeys);
    },
  });
};

export default cityModal;
